import time
class StopWatch:
    def __init__(self):
        self.__startTime = time.time()
        self.__endTime = time.time()

    def getStartTime(self):
        return self.__startTime
    def setStartTime(self,startTime):
        self.__startTime = startTime

    def getEndTime(self):
        return self.__endTime

    def setEndTime(self,endTime):
        self.__endTime = endTime

    def start(self):
        self.__startTime = time.time()

    def stop(self):
        self.__endTime = time.time()

    def getElapsedTime(self):
        return time.time() - self.__startTime

def main():
    stopWatch = StopWatch();
    stopWatch.start()
    for i in range(1,1000000):
        pass
    print("花了",stopWatch.getElapsedTime(),"秒")

main()